package com.kpx.app.bean;

import android.widget.ImageView;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/4/5.
 * 上传文件对象
 */

public class UploadBean implements Serializable, Comparable<UploadBean> {
    public String localPath;//待上传文件本地路径
    public boolean isUploadSuccess;//是否上传成功
    public String upLoadKey;//上传key
    public String id;//存储id
    public long imageID;
    public int uploaProgress;
    public ImageView imageView;
    public String cloudKey;
    public String bindOrderId;//绑定的订单id
    public String bucketName;
    public String titleName;
    public String imgUri;
    public String failMsg;
    public long createTime;
    public boolean isSuccess = false;

    private int uploadType;//上传文件类型
    public static final int TYPE_ORDER_IMG = 0;//订单图片
    public static final int TYPE_PHOTO_IMG = 1;//用户图片

    public int status = UPLOAD_TYPE_WAITTING;//上传状态
    public static final int UPLOAD_TYPE_UPLOADING = 0;//上传中
    public static final int UPLOAD_TYPE_WAITTING = 1;//等待上传（暂停）
    public static final int UPLOAD_TYPE_SUCCESSED = 2;
    public static final int UPLOAD_TYPE_FAIL = 3;
    public static final int UPLOAD_TYPE_STOP = 4;
    public static final int UPLOAD_TYPE_BIND_ING = 5;
    public static final int UPLOAD_TYPE_BIND_SUCCESS = 6;
    public static final int UPLOAD_TYPE_BIND_FAIL = 7;
    public static final int UPLOAD_TYPE_BIND_FAIL_2 = 8;//已达到最大图片数量

    public UploadBean(){
        super();
        createTime = System.currentTimeMillis();
    }
    @Override
    public int compareTo(UploadBean another) {
        if (another != null && another instanceof UploadBean) {
            return (imageID - another.imageID) > 0 ? 1 : (imageID == another.imageID ? 0 : -1);
        }
        return 0;
    }

    public String getTitleName() {
        return titleName;
    }

    public void setTitleName(String titleName) {
        this.titleName = titleName;
    }

    public int getUploaProgress() {
        return uploaProgress;
    }

    public void setUploaProgress(int uploaProgress) {
        this.uploaProgress = uploaProgress;
    }

    public String getFailMsg() {
        return failMsg;
    }

    public void setFailMsg(String failMsg) {
        this.failMsg = failMsg;
    }

    public int getUploadType() {
        return uploadType;
    }

    public void setUploadType(int uploadType) {
        this.uploadType = uploadType;
    }

    public String getBindOrderId() {
        return bindOrderId;
    }

    public void setBindOrderId(String bindOrderId) {
        this.bindOrderId = bindOrderId;
    }

    public long getImageID() {
        return imageID;
    }

    public void setImageID(long imageID) {
        this.imageID = imageID;
    }

    public ImageView getImageView() {
        return imageView;
    }

    public void setImageView(ImageView imageView) {
        this.imageView = imageView;
    }

    public String getCloudKey() {
        return cloudKey;
    }

    public void setCloudKey(String cloudKey) {
        this.cloudKey = cloudKey;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public String getImgUri() {
        return imgUri;
    }

    public void setImgUri(String imgUri) {
        this.imgUri = imgUri;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }

    public boolean isUploadSuccess() {
        return isUploadSuccess;
    }

    public void setUploadSuccess(boolean uploadSuccess) {
        isUploadSuccess = uploadSuccess;
    }

    public String getUpLoadKey() {
        return upLoadKey;
    }

    public void setUpLoadKey(String upLoadKey) {
        this.upLoadKey = upLoadKey;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
    public UploadBean copy() {
        UploadBean b = new UploadBean();
        b.bindOrderId = bindOrderId;
        b.bucketName = bucketName;
        b.localPath = localPath;
        b.isUploadSuccess = isUploadSuccess;
        b.id = id;
        b.imageID = imageID;
        b.uploaProgress = uploaProgress;
        b.imageView = imageView;
        b.imgUri = imgUri;
        b.cloudKey = cloudKey;
        b.failMsg = failMsg;
        b.createTime = createTime;
        b.status = status;
        b.titleName = titleName;
        b.uploadType = uploadType;
        b.isSuccess = isSuccess;
        return b;
    }
}
